/* === LICENSE INFO ===
 * This source file is subject to the GPLv3 license that is bundled with this
 * package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://www.gnu.org/licenses/gpl.txt
 * === end of LICENSE INFO === */

/*==============================================================================
  File Name   : TCPClientSocket.h
  Description : Declaration for TCPClientSocket class in GNetwork module.

  Created on  : 2009-06-07
  Updated on  : 2010-06-12
  Updated by  : Shiou Ming, Lee

  Cautions    : (important notes)
  ============================================================================*/

#ifndef TCPCLIENTSOCKET_H_
#define TCPCLIENTSOCKET_H_

#include <winsock2.h>
//#pragma comment(lib,"wsock32.lib")

#define SCK_VERSION1_ 0x0101  // WinSock
#define SCK_VERSION2_ 0x0202  // WinSock v2


class TCPClientSocket
{
public:
    TCPClientSocket();
    TCPClientSocket(const char* serverIP, u_short serverPort);
    ~TCPClientSocket();
    bool setRemoteAddress(const char* remoteIP, u_short remotePort);
    bool connectServer();
    bool connectServer(const char* remoteIP, u_short remotePort);
    int sendTextData(const char* textData);
    int receiveTextData(char* textDataBuffer, u_int bufferLen);

private:
    u_int m_clientSocket;
    sockaddr_in m_serverAddress;
    bool createSocket();
};


#endif /* TCPCLIENTSOCKET_H_ */
